package com.shxzz.easy12306.services.ticket.service;

import com.shxzz.easy12306.services.ticket.dao.entity.SeatCountDO;
import com.shxzz.easy12306.services.ticket.dto.domain.RouteDTO;
import com.shxzz.easy12306.services.ticket.dto.domain.SelectSeatDTO;
import com.shxzz.easy12306.services.ticket.service.handler.dto.SeatSelectRespDTO;

import java.util.List;

/**
 * 座位服务层接口
 * @author shxzz
 * @create 2024-03-07-23:51
 */
public interface SeatService {
    /**
     * 查询指定列车，对应座位类型有余票的车厢号
     */
    List<String> listAvailableCarriageNumber(String trainId, Integer seatType, String departure, String arrival);

    /**
     * 查询指定列车，指定座位类型的车厢内空余座位数量
     */
    List<SeatCountDO> countCarriageRemainTicketBySeatType(String trainId, Integer seatType, String departure, String arrival);

    /**
     * 查询列车指定车厢空闲座位号
     */
    List<String> listAvailableSeats(String trainId, String carriageNumber, Integer seatType, String departure, String arrival);

    /**
     * 锁定选择的座位对应路线的状态
     */
    void lockSeat(String trainId, List<SeatSelectRespDTO> seatSelectRespDTOlist, List<RouteDTO> routeDTOList);

    /**
     * 解锁选择的座位对应路线的状态
     */
    void unlockSeat(String trainId, List<RouteDTO> routeDTOList, List<SelectSeatDTO> selectSeatDTOList);

    /**
     * 回滚选择的座位对应路线的余票缓存
     */
    void rollbackTicketRemainCache(List<SelectSeatDTO> selectSeatDTOList, List<RouteDTO> routeDTOList, String trainId);

    /**
     * 回滚座位状态，包含座位解锁、余票回滚、令牌桶回滚
     */
    void rollbackSeatStatus(String trainId, String departure, String arrival, List<SelectSeatDTO> selectSeatDTOList);

    /**
     * 支付回调修改座位状态
     */
    void payCallback(String orderSn);

}
